<template>
	<header>
		<div class="header-container">
			<div class="back-icon" @click="back()">
				<span v-if="lftext">{{lftext}}</span>
				<i v-if="!lftext" class="iconfont">&#xe877;</i>
			</div>
			<div class="header-title">{{ title }}</div>
			<div class="header-delete" v-on:click="findelete()">{{ delet }}</div>
		</div>
		<div class="header-blank"></div>
	</header>
</template>

<script>
	export default {
		props: {
			lftext: String,
			title: String,
			backUrl: String,
			delet: String
		},
		methods: {
			back() {
				if (this.backUrl) {
					this.$router.replace(this.backUrl);
				} else {
					this.$router.go(-1);
				}
			},
			findelete(info){
				this.$emit('dele',info);
			}
		}
	}
</script>

<style lang="scss" scoped>
	.header-container {
		position: fixed;
		z-index: 100;
		top: 0;
		background-color: #fff;
		width: 100%;
		height: 44px;
		line-height: 44px;
		display: flex;
		align-items: center;
		justify-content: center;
		text-align: center;
		box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.07);
		.back-icon {
			position: absolute;
			left: 18px;
			// padding: 0 10px;
			i {
				font-size: 20px;
				color: #666;
			}
		}
		.header-delete {
			cursor: pointer;
			position: absolute;
			right: 15px;
			bottom: 12px;
			// padding: 0 10px;
			// width: 100px;
			height: 20px;
			line-height: 20px;
			color: #0089FC;
		}
		.header-title {
			font-weight: bold;
		}
	}
	.header-blank {
		padding-bottom: 44px;
	}
</style>